package com.sky.mapper.user;

import com.sky.pojo.ShoppingCart;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
//    @Select("select * from shopping_cart where user_id = #{userId} and (setmeal_id = #{setmealId} or dish_id = #{dishId}) and dish_flavor = #{dishFlavor}")
    ShoppingCart findByDishIdOrSetmealId(ShoppingCart shoppingCart);

    @Update("update shopping_cart set number =number + #{num} where id = #{id}")
    void updateNum(Long id, Integer num);

    void insert(ShoppingCart shoppingCart);

    @Select("select * from shopping_cart where user_id = #{userId}")
    List<ShoppingCart> list(Long userId);

    @Delete("delete from shopping_cart where user_id = #{userId}")
    void clean(Long userId);

    void insertBatch(List<ShoppingCart> shoppingCartList);

//    Integer getMakeTimeByUserId(Long currentId);
}
